package com.example.agricultural_big_data.controller;

import com.example.agricultural_big_data.pojo.Crop;
import com.example.agricultural_big_data.pojo.Know;
import com.example.agricultural_big_data.pojo.Plantation;
import com.example.agricultural_big_data.service.CropService;
import com.example.agricultural_big_data.util.AjaxResult;
import com.example.agricultural_big_data.util.LoginRequired;
import com.example.agricultural_big_data.util.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.List;

/**
 * ClassName:CropController
 * Package:com.example.agricultural_big_data.controller
 * Description:
 *
 * @Data:2022/5/16 15:56
 */
@RestController
@CrossOrigin
@RequestMapping("/crop")
public class CropController extends BaseController {

    @Autowired
    private CropService cropService;

    @LoginRequired
    @GetMapping("/list")
    public TableDataInfo list(Crop crop){
        List<Crop> list = cropService.getCropList(crop);
        return getDataTable(list);
    }

    @LoginRequired
    @GetMapping("/knowList")
    public TableDataInfo list(Know know){
        List<Know> list = cropService.getKnowList(know);
        return getDataTable(list);
    }

    @LoginRequired
    @PostMapping("/add")
    public AjaxResult add(@RequestBody Crop crop){
        int i = cropService.addCrop(crop);
        return null;
    }




}
